package com.bidevalution.business.service;

import com.bidevalution.business.dto.VoteResultDto;
import com.bidevalution.dao.entity.BeExpertVoteResult;
import com.bidevalution.dao.entity.BeSectionStep;
import com.sun.org.apache.xpath.internal.operations.Bool;

import java.util.List;
import java.util.Map;

/**
 * Created by glodon on 2019-08-15.
 */
public interface BeExpertVoteResultService {
    /**
     * 专家投票推选组长
     *
     * @param loginName
     * @param sectionId
     * @param voteExpertId
     * @param sectionStepId
     * @param voteType
     * @param flag          1、其它投票调用 2、评审结束按钮调用（因为按钮是通过动态配置的，评审结束按钮需要执行更新操作
     * @return
     * @throws Exception
     */
    Boolean voteExpert(String loginName, String sectionId, String voteExpertId, String sectionStepId, String voteType, int flag) throws Exception;

    /**
     * 查询当前账号推选结果
     *
     * @param sectionId
     * @return
     * @throws Exception
     */
    BeExpertVoteResult getBeExpertVoteResult(String expertId, String sectionId, String voteType) throws Exception;

    /**
     * 查询当前标段的投标结果
     *
     * @param sectionId
     * @return
     * @throws Exception
     */
    List<VoteResultDto> getVoteResultList(String sectionId, String voteType) throws Exception;

    /**
     * 判断是否投票结果是否重复
     *
     * @param sectionId
     * @return
     * @throws Exception
     */
    Boolean isRepeatedVotes(String sectionId, String voteType) throws Exception;

    /**
     * 重复清除投票结果进行重新投票
     * @param sectionId
     * @param voteType
     * @return
     * @throws Exception
     */
    int delRepeatedVotes(String sectionId, String voteType) throws Exception;

    List<Map<String, Object>> getVoteResultDetailList(String sectionId, String voteType, String submitCode);

    /**
     * 获取当前登录账号的投票结果信息（用于重评）
     *
     * @param beExpertVoteResult
     * @return
     */
    BeExpertVoteResult queryResultByExpertId(BeExpertVoteResult beExpertVoteResult) throws Exception;

    /**
     * 根据标段id删除投票结果信息
     *
     * @param sectionId
     * @param voteType
     * @param submitCode
     * @return
     * @throws Exception
     */
    int delBySectionId(String sectionId, String voteType, String submitCode) throws Exception;

    /**
     * 重评判断是否所有专家都投票完成，完成则计算少数服从多数
     *
     * @param sectionId
     * @param voteType
     * @param submitCode
     * @return
     * @throws Exception
     */
    String computerVoteResult(String sectionId, String voteType, String submitCode) throws Exception;
}
